home *** CD-ROM | disk | FTP | other *** search
- #ifndef __TRACKSINFO__
- #define __TRACKSINFO__
-
- //
- // some debugging macros...
- // To add a trace point, define it in TraceInfo.h and modify the STR# resource in
- // your driver (id 777).
- //
-
- // Trace stuff
-
- #define kInstallTrace 20 // install trace csParam contains ProcPtr and ArgPtr
- #define kRemoveTrace 21 // remove trace
-
-
- // On csCode == kInstallTrace, the csParamPtr should be casted to this stucture to
- // fill in your global varibles...
- typedef struct
- {
- ProcPtr TraceProc;
- Ptr TraceGlobals;
- } TraceData, *TraceDataPtr;
-
-
- //
- // DIAGNOSTIC ID is a unique number (0-127) that identifies the calling macro.
- // Tracing of these functions can be controlled through the cdev.
- // If you add to this list or modify it in any way, you also must (should) update the STR#
- // In your drivers resource file. It will be read by the Trace CDEV and Dumptrace.
- //
- // NOTE:
- // The STR# resource type starts at 1. Our list starts at 0.
- // So if you #define kNewTraceCall 87, you need to modify number 88 in the STR# list.
- //
- // The PARTCODE is a number that is associated with the diagnostic id. They should number from 0 to
- // however many trace calls you have with the same diag id. The reason for the partcode is that
- // if the a trace call is locked out, due to an interrupt already accessing the trace code,
- // you will know what happened to the trace info...
- //
-
- // Level's 1-4 function trace starting points
- #define kTraceLevel1 0
- #define kTraceLevel2 32
- #define kTraceLevel3 64
- #define kTraceLevel4 96
-
-
- /** FORMAT ID's for trace calls **/
- #define kTraceStackPeekFmt 1 // StackPeek data- see u:trace:src:drvr:stackpeek for more info
- #define kTraceDataBlockFmt 2 // data1 points to the block. data2 == length of block, 3 ignored.
- #define kTracePStrFmt 3 // data1 = Pstr, 2 & 3 ignored.
- #define kTraceLongFmt 4 // data1 contains four bytes. 2 & 3 ignored.
- #define kTracePStrLongFmt 5 // data1 = Pstr, 2 = Long, 3 = 0L;
- #define kTraceDataTypeFmt 6 // data1 = Ptr to block, 2 = length, 3 = pstr of Type
-
-
-
- #ifdef GOLD
-
- #define T_TYPE(diagID, partCode, dataPtr, dataLen, typePStr) ;
- #define T_PSTR(diagID, partCode, thePStr) ;
- #define T_PSTRLONG(diagID, partCode, thePStr, theLong) ;
- #define T_STACK(diagID) ;
- #define TRACE(diagID,partCode,formatID,data1, data2, data3) ;
-
- #endif GOLD
-
- #ifndef GOLD
-
- #define TRACE(diagID,partCode,formatID,data1, data2, data3) \
- { register ProcPtr func; \
- func = globals->fTraceProcPtr; \
- if (func != 0) \
- (*((pascal void (*)(Ptr, char, char, char, long, long, long))func)) \
- (globals->fTraceArg, (diagID), (partCode), (formatID), \
- (data1),(data2), (data3)); }
-
-
-
- #define T_TYPE(diagID, partCode, dataPtr, dataLen, typePStr) \
- TRACE(diagID, partCode, kTraceDataTypeFmt, (long)dataPtr, dataLen, (long)typePStr)
-
- #define T_STACK(diagID) \
- TRACE(diagID, 0, kTraceStackPeekFmt, 0L, 0L, 0L)
-
- // For passing a pascal string only...
-
- #define T_PSTR(diagID, partCode, thePStr) \
- TRACE(diagID, partCode, kTracePStrFmt, (long)thePStr, 0L, 0L)
-
- // For passing a pascal string and a long...
-
- #define T_PSTRLONG(diagID, partCode, thePStr, theLong) \
- TRACE(diagID, partCode, kTracePStrLongFmt, (long)thePStr, (long)theLong, 0L)
-
-
- // For passing data blocks... Pass a pointer to the block and how many bytes to copy.
- #define T_DATA(diagID, partCode, theData, theLength) \
- TRACE(diagID, partCode, kTraceDataBlockFmt, (long)theData, (long)theLength, 0L)
-
- #endif GOLD
-
- /************ CALLING EXAMPLES ***************
-
- // Here we are sending two formatted data types...
- // Both have diagnostic ID 97, which means they are both controlled by checkmark 97 (or Str# Id 777, item 98)
- // (either on, off, and/or breakpoint set). If more than one trace call share the same diagID,
- // they should have different part codes (in this case, 0 and 1). They should start at 0 and increment by 1.
-
- T_TYPE (97, 0, &myEvent, (long)sizeof(EventRecord), (long)"\pEventRecord");
- T_TYPE(97, 1, dCtl, (long)sizeof(DCtlEntry), (long)"\pDCtlEntry");
-
- // Here, in another section of code, we are sending a pascal string.
- T_PSTR(48, 0, "\pOh my gosh!");
-
- // Here we send a pstring and a long...
- T_XXXX(48,0… ); some Tracks call with diagID 48, partCode 0..
- T_PSTRLONG(48, 1, "\paLong = ", aLong);
-
- // This sends information about who called current routine
- // and what the current routine is. If c++ is being used, arguments will also be shown.
-
- T_STACK(5); // the 5 is the Diagnostic ID (can be 0-127).
-
- // Lastly, this just sends out a block of data... (20 bytes in this example)
- T_DATA(45, 0, &dataBlock, 20);
-
- *********************************************/
-
- #endif __TRACKSINFO__
-